<?php
    if ($this->pages) 
    {
?>
<div class="pagination top"><div class="pag-small"><?=$this->pages;?></div></div>
<?
    }

$numRows = sizeof($this->files);
if ($numRows) {
?>
<table width="100%" cellspacing="0" cellpadding="0" class="edit_block" style="padding: 15px;">
<?
    while (list(, $file) = each($this->files)) 
    {
?>
	  <tr> 
	  	<td class="first" width="10%" align="center">
	  		<img src="<?=_ROOT_URL.$this->thumbFolder.$file->GetThumbnail();?>">
	  	</td>
		<td class="title">
			<div class="date-block"><?=$file->GetPublishDate();?></div>
			<div><?=$file->GetType();?></div>
			<?=$file->GetTitle();?>
			<div class="tags-block"><?=$file->GetTags();?></div>
		</td>
		<?php 
		if ($this->params['addButtonCallback'])
		{
		?>	
		<td width="1"><a
			href="#"
			title="добавить" onclick="return <?php echo $this->params['addButtonCallback']; ?>(<?=$file->GetId();?>);" ><img
			src="<?=_ROOT_URL;?>files/images/admin/icons/add_16x16.png" alt="add"
			title="" width="16" height="16"></a></td>
		<?php 
		}
		?>
		<?php 
		if ($this->params['contentButton'])
		{
		?>	
		<td width="1"><a
			href="#"
			title="добавить в контент" onclick="return addMediaToContent(<?=$file->GetId();?>);" ><img
			src="<?=_ROOT_URL;?>files/images/admin/icons/right_arrow_16x16.png" alt="add"
			title="" width="16" height="16"></a>
			<input id="mediaHTML_<?=$file->GetId();?>" type="hidden" value="<?=htmlspecialchars($this->mediaControl->Get($file));?>"></td>
		<?php 
		}
		?>	
	</tr>
<?
    }
?>
 </table>
<?
} else {
    ?>
	файлы не найдены
<?
}

	if ($this->pages) 
	{
?>
<div class="pagination"><div class="pag-small"><?=$this->pages;?></div></div>
<?
    }
?> 
<script type="text/javascript">
$(document).ready(function() 
{
	$('#mediaBlockFiles .pagination a').click(function(){
		$.ajax({url: this.href,
				dataType: 'json',
				type: 'get',
				success: LoadMediaFilesBlock
		});
		return false;
	});
});		
</script>